//package apigateway.com.cj.泛化调用;
//
//import org.apache.dubbo.config.ApplicationConfig;
//import org.apache.dubbo.config.RegistryConfig;
//import org.apache.dubbo.config.ServiceConfig;
//import org.apache.dubbo.rpc.service.GenericService;
//
//import java.util.concurrent.CountDownLatch;
//
///**
// * @author caojie
// * @version 1.0
// * @Description
// * @date 2023/8/7 15:41
// */
//public class Application {
//    private static String zookeeperAddress = "zookeeper://" + System.getProperty("zookeeper.address", "127.0.0.1") + ":2181";
//
//    public static void main(String[] args) {
//        new EmbeddedZooKeeper(2181, false).start();
//
//        //创建ApplicationConfig
//        ApplicationConfig applicationConfig = new ApplicationConfig();
//        applicationConfig.setName("generic-impl-provider");
//        //创建注册中心配置
//        RegistryConfig registryConfig = new RegistryConfig();
//        registryConfig.setAddress(zookeeperAddress);
//
//        //新建服务实现类，注意要使用GenericService接收
//        GenericService helloService = new GenericImplOfHelloService();
//
//        //创建服务相关配置
//        ServiceConfig<GenericService> service = new ServiceConfig<>();
//        service.setApplication(applicationConfig);
//        service.setRegistry(registryConfig);
//        service.setInterface("org.apache.dubbo.samples.generic.call.api.HelloService");
//        service.setRef(helloService);
//        //重点：设置为泛化调用
//        //注：不再推荐使用参数为布尔值的setGeneric函数
//        //应该使用referenceConfig.setGeneric("true")代替
//        service.setGeneric("true");
//        service.export();
//
//        System.out.println("dubbo service started");
//
//        new CountDownLatch(1).await();
//    }
//}
